<?php

namespace catchAdmin\phone\controller;

use catchAdmin\phone\request\userCompany\saveRequest;
use catcher\CatchResponse;

class UserCompany extends LoginCatchController
{

    private $model = null;


    public function __construct()
    {
        parent::__construct();

        $this->model = (new \catchAdmin\phone\model\UserCompany());
    }


    public function save(saveRequest $request)
    {
        $param = request()->param();

        return CatchResponse::success($this->model->saveData($param));
    }


    ################################# 显示 #####################

    public function read()
    {
        $param = request()->param();

        return CatchResponse::success($this->model->readData($param));
    }


    public function indexDian()
    {
        $list = (new \catchAdmin\model\UserCompany())->getDianList();

        $list_1 = [];
        foreach ($list as $k => $item) {
            $list_1[] = [
                'id'   => $k,
                'name' => $item,
            ];
        }

        return CatchResponse::success($list_1);
    }


    public function indexJiTuan()
    {
        $list = (new \catchAdmin\model\UserCompany())->getJiTuanList();

        $list_1 = [];
        foreach ($list as $k => $item) {
            $list_1[] = [
                'id'   => $k,
                'name' => $item,
            ];
        }

        return CatchResponse::success($list_1);
    }


    public function indexWaiMao()
    {
        $list = (new \catchAdmin\model\UserCompany())->getWaiMaoList();

        $list_1 = [];
        foreach ($list as $k => $item) {
            $list_1[] = [
                'id'   => $k,
                'name' => $item,
            ];
        }

        return CatchResponse::success($list_1);
    }


}
